org 0x7c00
[bits 16]
xor ax, ax ; eax = 0
; 初始化段寄存器, 段地址全部设为0
mov ds, ax
mov ss, ax
mov es, ax
mov fs, ax
mov gs, ax

; 初始化栈指针
mov sp, 0x7c00
mov ax, 0xb800
mov edi, (80*12+12)*2
mov gs, ax


mov ah, 0xbc ;
mov al, '1'
mov [gs: edi + 2 * 0], ax

mov al, '9'
mov [gs: edi + 2 * 1], ax

mov al, '3'
mov [gs: edi + 2 * 2], ax

mov al, '3'
mov [gs: edi + 2 * 3], ax

mov al, '5'
mov [gs: edi + 2 * 4], ax

get_pos:
push dx
push bx
mov al,0x0e
mov dx,0x03d4
out dx,al
mov dx,0x03d5
in al,dx
mov bl,al
int 03h
mov al,0x0f
mov dx,0x3d4
out dx,al
mov dx,0x03d5

in al,dx
mov ah,bl
pop bx
pop dx
ret

mov al, '2'
mov [gs: edi + 2 * 5], ax

mov al, '5'
mov [gs: edi + 2 * 6], ax

mov al, '3'
mov [gs: edi + 2 * 7], ax


jmp $ ; 死循环

times 510 - ($ - $$) db 0
db 0x55, 0xaa
